package com.haoting.mamba.ucenter.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.haoting.mamba.ucenter.entity.UserFollowEntity;
import com.haoting.mamba.ucenter.service.UserFollowService;
import com.haoting.common.utils.PageUtils;
import com.haoting.common.utils.R;



/**
 * 
 *
 * @author tanghao
 * @email 767417609@qq.com
 * @date 2021-03-14 22:56:07
 */
@RestController
@RequestMapping("ucenter/userfollow")
public class UserFollowController {
    @Autowired
    private UserFollowService userFollowService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userFollowService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{followId}")
    public R info(@PathVariable("followId") String followId){
		UserFollowEntity userFollow = userFollowService.getById(followId);

        return R.ok().put("userFollow", userFollow);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody UserFollowEntity userFollow){
		userFollowService.save(userFollow);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserFollowEntity userFollow){
		userFollowService.updateById(userFollow);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] followIds){
		userFollowService.removeByIds(Arrays.asList(followIds));

        return R.ok();
    }

}
